<?php
class SwitchAction extends Action {
	function init(){}
	
	function cmdIndex(){
		$template=isset($_GET['t'])?$_GET['t']:null;
		$returl=isset($_GET['returl'])?$_GET['returl']:enUrl(PATH."/index.php");
		$tempconf=$GLOBALS['TEMPCONF'];
		$type=$tempconf[$template][0];
		$ac=$_SERVER[HTTP_ACCEPT];
		if(strlen($ac)>strlen(str_replace($type,"",$ac))){
			$_SESSION["Themes"]=$template;
			$this->Message("版本切换成功！","切换成功",deUrl($returl),3);
		}else{
			$this->assign("title","版本切换");
			$this->assign("content","系统检测到你要切换的版本与你的设备可能不兼容，是否继续？");
			$this->assign("returl",$returl);
			$this->assign("t",$template);
			$this->display("Switch.htm");
			}
		}
	function cmdConfimSwitch(){
		$template=isset($_GET['t'])?$_GET['t']:null;
		$returl=isset($_GET['returl'])?$_GET['returl']:enUrl(PATH."/index.php");
		$_SESSION["Themes"]=$template;
		$this->Message("版本切换成功！","切换成功",deUrl($returl),3);
	}
	}